package net.lcheng.sellerCenter.utils;

/**
 * 手机号处理
 * Created by LV on 2016/7/5.
 */
public class PhoneNumUtil {
    private static PhoneNumUtil ourInstance = new PhoneNumUtil();

    private PhoneNumUtil() {
    }

    private String phoneNumChange(String phoneNum){
        String temp;
        if (phoneNum.length()==11){
            temp = phoneNum.substring(0, 3) + "****" + phoneNum.substring(7, 11);
            return temp;
        }
        if (phoneNum.length()==12){
            temp = phoneNum.substring(0, 3) + "*****" + phoneNum.substring(8, 12);
            return temp;
        }
            return "";
    }

    /**
     * 将手机号转换成123*****321的形式
     */
    public static String getPhoneNumChange(String phoneNum){
        return ourInstance.phoneNumChange(phoneNum);
    }
}
